<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta http-equiv="pragma" content="no-cache" />
	<meta http-equiv="expires" content="-1" />
	<link rel="stylesheet" type="text/css" href="/site_media/css/style.css" />
	<title>Labmin - informacje o usłudze</title>
</head>
<body>
	<div id="wrap">
		{% include "header.html" %}
		{% if request.session.user %}
			<div id="content-wrap">
				{% include "sidebar.html" %}
				<div id="main">
					<div class="box">
                		<h1>Informacje <span class="gray">o usłudze</span></h1>
					</div>
					<div class="box" style="padding: 10px;">
						<table>
							<tr>
								<th>nazwa:</th>
								<td><b>{{ service.name }}</b></td>
							</tr>
							<tr>
								<th>opis:</th>
								<td>{{ service.description }}</td>
							</tr>
							<tr>
								<th>adres:</th>
								<td>{{ service.ip_address }}/{{ service.port }}</td>
							</tr>
							<tr>
								<th>plik ze skryptem:</th>
								<td><a href="/{{service.script_file.name}}">{{ service.script_file.name }}</a></td>
							</tr>
							<tr>
								<th>grupy:</th>
								<td><ul style="margin:0px; color:inherit;">
									{% for service_group in service.servicegroup_set.all %}
									<li>
									<a href="/show_service_group/{{service_group.pk}}">{{ service_group.name }}</a>
									</li>
									{% endfor %}
									</ul>
								</td>
							</tr>
							<tr>
								<th>studenci:</th>
								<td><ul style="margin:0px; color:inherit;">
									{% for association in service.studentserviceassociation_set.select_related %}
									<li>
										<a href="/show_student/{{association.student.pk}}">{{ association.student }}</a>
										{% if not association.is_active %}
										 (nieaktywna)
										{% endif %}
										</li>
										{% endfor %}
									</ul></td>
                                </tr>
						</table>
					</div>
					{% if request.session.user.is_superadmin %}
					<form action="" method="post" style="margin: 0px">
						<input type="hidden" name="service_pk" value="{{service.pk}}" />
						<div class="box" style="padding: 10px;">
							<input class="button" type="button" value="Edytuj" onclick="window.location='/service_form/{{service.pk}}'" />
							<input class="button" type="button" value="Usuń" onclick="document.forms[0].action='/delete_services'; document.forms[0].submit();" />
						</div>
					</form>
					{% endif %}
				</div>
			</div>
		{% endif %}
	</div>
	{% include "footer.html" %}
</body>
</html>
